import { Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
import { MaxLength } from 'class-validator';

@Entity('shop-address')
export class AddressEntity {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ comment: '用户id' })
  userId: number;

  @Column({ length: 50, comment: '收货人姓名' })
  name: string;

  @Column({ length: 20, comment: '收货人电话' })
  phone: string;

  @Column({ length: 255, comment: '省市区地址' })
  address: string;

  @Column({ type: 'simple-array', comment: '省市区编码' })
  addressCode: string[];

  @Column({ length: 255, comment: '地址详情' })
  detailAdd: string;

  @Column({ comment: '是否默认', default: false })
  isDefault: boolean;

  @CreateDateColumn()
  createTime: Date;

  @UpdateDateColumn()
  updateTime: Date;
}
